enum ZHENGFAN {
    //% block="正"
    HIGH,
    //% block="反"
    LOW
}

//% color="#660099" iconWidth=50 iconHeight=40
namespace moto1 {
    //% block="设置电机D2D3的转动方向为[ZHENGFAN],转动速度为[SUDU]" blockType="command"
    //% ZHENGFAN.shadow="dropdown" ZHENGFAN.options="ZHENGFAN" ZHENGFAN.defl="HIGH"
    //% SUDU.shadow="range" SUDU.params.min=0 SUDU.params.max=255 SUDU.defl=100
    export function moto1_D2D3(parameter: any, block: any) {
        let zhengfan = parameter.ZHENGFAN.code;
        let sudu = parameter.SUDU.code;

        Generator.addCode(`digitalWrite(2, ${zhengfan});`);
        Generator.addCode(`analogWrite(3, ${sudu});`);
     }

    //% block="设置电机D4D5的转动方向为[ZHENGFAN],转动速度为[SUDU]" blockType="command"
    //% ZHENGFAN.shadow="dropdown" ZHENGFAN.options="ZHENGFAN" ZHENGFAN.defl="HIGH"
    //% SUDU.shadow="range" SUDU.params.min=0 SUDU.params.max=255 SUDU.defl=100
    export function moto1_D4D5(parameter: any, block: any) {
        let zhengfan = parameter.ZHENGFAN.code;
        let sudu = parameter.SUDU.code;

        Generator.addCode(`digitalWrite(4, ${zhengfan});`);
        Generator.addCode(`analogWrite(5, ${sudu});`);
     }

    //% block="设置电机D6D7的转动方向为[ZHENGFAN],转动速度为[SUDU]" blockType="command"
    //% ZHENGFAN.shadow="dropdown" ZHENGFAN.options="ZHENGFAN" ZHENGFAN.defl="HIGH"
    //% SUDU.shadow="range" SUDU.params.min=0 SUDU.params.max=255 SUDU.defl=100
    export function moto1_D6D7(parameter: any, block: any) {
        let zhengfan = parameter.ZHENGFAN.code;
        let sudu = parameter.SUDU.code;

        Generator.addCode(`digitalWrite(7, ${zhengfan});`);
        Generator.addCode(`analogWrite(6, ${sudu});`);
     }

    //% block="设置电机D8D9的转动方向为[ZHENGFAN],转动速度为[SUDU]" blockType="command"
    //% ZHENGFAN.shadow="dropdown" ZHENGFAN.options="ZHENGFAN" ZHENGFAN.defl="HIGH"
    //% SUDU.shadow="range" SUDU.params.min=0 SUDU.params.max=255 SUDU.defl=100
    export function moto1_D8D9(parameter: any, block: any) {
        let zhengfan = parameter.ZHENGFAN.code;
        let sudu = parameter.SUDU.code;

        Generator.addCode(`digitalWrite(8, ${zhengfan});`);
        Generator.addCode(`analogWrite(9, ${sudu});`);
    }
}